﻿using MediatR;
using Sowrk03_28.Repository;
using Swork03_28.Api.Application.Commands.FarmedCommand;
using Swork03_28.Domain.TraceableInfos;

namespace Swork03_28.Api.Application.CommandHandlers.FarmedHandler
{
    public class ViccineSelectCommandHandler : IRequestHandler<VIccineSelectCommand, List<Vaccine>>
    {
        private readonly IRepository<Vaccine> repository;

        public ViccineSelectCommandHandler(IRepository<Vaccine> repository)
        {
            this.repository = repository;
        }

        public async Task<List<Vaccine>> Handle(VIccineSelectCommand request, CancellationToken cancellationToken)
        {
            var info = await repository.GetValues(x => x.BatchId == request.BatchId);
            return info.ToList();
        }
    }
}
